<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/css/login.css" />
</head>

<body class="beg-login-bg">
<div class="beg-login-box">
    <header>
        <h1>后台登录</h1>
    </header>
    <div class="beg-login-main">
        <form class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="beg-login-icon">
                    <i class="layui-icon">&#xe612;</i>
                </label>
                <input type="text" name="username" lay-verify="required|username" autocomplete="off" placeholder="这里输入登录名" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="beg-login-icon">
                    <i class="layui-icon">&#xe642;</i>
                </label>
                <input type="password" name="password" lay-verify="required|password" autocomplete="off" placeholder="这里输入密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <!--div class="beg-pull-left beg-login-remember">
							<label>记住帐号？</label>
							<input type="checkbox" name="rememberMe" value="true" lay-skin="switch" checked title="记住帐号">
						</div>-->
<%--                <div class="beg-pull-right">--%>
                    <button style="width: 100%" type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                        <i class="layui-icon">&#xe650;</i> 登录
                    </button>
<%--                </div>--%>
<%--                <div class="beg-clear"></div>--%>
            </div>
        </form>
    </div>
    <footer>
        <p>snowsea © www.snowsea.com.cn</p>
    </footer>
</div>
<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;

        form.on('submit(login)',function(data){
            var param = JSON.stringify(data.field)
            if (param == null) {
                return false
            }
            if (param == undefined) {
                return false
            }
            console.log(param);
            $.ajax({
                url: "/resume/login",
                type: "POST",
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                data: param,
                success: function (json) {
                    console.log(json)
                    if (json.code == 200) {
                        window.location.href = '/resume/main';
                    } else {
                        layer.msg(json.msg);
                    }
                },
                error: function (error) {
                    console.log(error)
                }
            });
        });
    });
</script>
</body>

</html>